package com.ecoolex.hotel.saas.entity;

import com.ecoolex.framework.common.annotation.Description;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import org.springframework.lang.NonNull;

/**
 *
 *   分销<br>
 *<br>
 * 数据表： distribution
 *
 */
@Description({"分销"})
public class Distribution implements Serializable {
    public static final Boolean IS_DELETED = Deleted.IS_DELETED.value();

    public static final Boolean NOT_DELETED = Deleted.NOT_DELETED.value();

    /**
     *
     *   分销Id    <br>
     *<br>
     * 字段名： distribution.DistributionId
     */
    @Description({"分销Id", "不能为空", "数据长度: 10"})
    @NonNull
    private Integer distributionId;

    /**
     *
     *   部门Id    <br>
     *<br>
     * 字段名： distribution.DepartmentId
     */
    @Description({"部门Id", "不能为空", "数据长度: 10"})
    @NonNull
    private Integer departmentId;

    /**
     *
     *   分销类型：1-按比例分销；2-按金额分销    <br>
     *<br>
     * 字段名： distribution.Type
     */
    @Description({"分销类型：1-按比例分销；2-按金额分销", "不能为空", "数据长度: 5"})
    @NonNull
    private Integer type;

    /**
     *
     *   分销比例，百分比（如5%填5即可）    <br>
     *<br>
     * 字段名： distribution.DistributionRatio
     */
    @Description({"分销比例，百分比（如5%填5即可）", "数据长度: 4"})
    private BigDecimal distributionRatio;

    /**
     *
     *   分销金额    <br>
     *<br>
     * 字段名： distribution.DistributionAmt
     */
    @Description({"分销金额", "数据长度: 4"})
    private BigDecimal distributionAmt;

    /**
     *
     *   逻辑删除    <br>
     *<br>
     * 字段名： distribution.Deleted
     */
    @Description({"逻辑删除", "不能为空", "数据长度: 1"})
    @NonNull
    private Boolean deleted;

    /**
     *
     *   创建用户    <br>
     *<br>
     * 字段名： distribution.CreateUser
     */
    @Description({"创建用户", "不能为空", "数据长度: 50"})
    @NonNull
    private String createUser;

    /**
     *
     *   创建时间    <br>
     *<br>
     * 字段名： distribution.CreateTime
     */
    @Description({"创建时间", "不能为空", "数据长度: 26"})
    @NonNull
    private Date createTime;

    /**
     *
     *   修改用户    <br>
     *<br>
     * 字段名： distribution.UpdateUser
     */
    @Description({"修改用户", "不能为空", "数据长度: 50"})
    @NonNull
    private String updateUser;

    /**
     *
     *   修改时间    <br>
     *<br>
     * 字段名： distribution.UpdateTime
     */
    @Description({"修改时间", "不能为空", "数据长度: 26"})
    @NonNull
    private Date updateTime;

    private static final long serialVersionUID = 1L;

    /**
     * 获取参数<br><br>
     *
     *   分销Id    <br>
     *<br>
     * 字段名： distribution.DistributionId
     */
    public Integer getDistributionId() {
        return distributionId;
    }

    /**
     * 设置参数<br><br>
     *
     *   分销Id<br>
     *<br>
     * 字段名： distribution.DistributionId
     */
    public void setDistributionId(Integer distributionId) {
        this.distributionId = distributionId;
    }

    /**
     * 获取参数<br><br>
     *
     *   部门Id    <br>
     *<br>
     * 字段名： distribution.DepartmentId
     */
    public Integer getDepartmentId() {
        return departmentId;
    }

    /**
     * 设置参数<br><br>
     *
     *   部门Id<br>
     *<br>
     * 字段名： distribution.DepartmentId
     */
    public void setDepartmentId(Integer departmentId) {
        this.departmentId = departmentId;
    }

    /**
     * 获取参数<br><br>
     *
     *   分销类型：1-按比例分销；2-按金额分销    <br>
     *<br>
     * 字段名： distribution.Type
     */
    public Integer getType() {
        return type;
    }

    /**
     * 设置参数<br><br>
     *
     *   分销类型：1-按比例分销；2-按金额分销<br>
     *<br>
     * 字段名： distribution.Type
     */
    public void setType(Integer type) {
        this.type = type;
    }

    /**
     * 获取参数<br><br>
     *
     *   分销比例，百分比（如5%填5即可）    <br>
     *<br>
     * 字段名： distribution.DistributionRatio
     */
    public BigDecimal getDistributionRatio() {
        return distributionRatio;
    }

    /**
     * 设置参数<br><br>
     *
     *   分销比例，百分比（如5%填5即可）<br>
     *<br>
     * 字段名： distribution.DistributionRatio
     */
    public void setDistributionRatio(BigDecimal distributionRatio) {
        this.distributionRatio = distributionRatio;
    }

    /**
     * 获取参数<br><br>
     *
     *   分销金额    <br>
     *<br>
     * 字段名： distribution.DistributionAmt
     */
    public BigDecimal getDistributionAmt() {
        return distributionAmt;
    }

    /**
     * 设置参数<br><br>
     *
     *   分销金额<br>
     *<br>
     * 字段名： distribution.DistributionAmt
     */
    public void setDistributionAmt(BigDecimal distributionAmt) {
        this.distributionAmt = distributionAmt;
    }

    public void andLogicalDeleted(boolean deleted) {
        setDeleted(deleted ? Deleted.IS_DELETED.value() : Deleted.NOT_DELETED.value());
    }

    /**
     * 获取参数<br><br>
     *
     *   逻辑删除    <br>
     *<br>
     * 字段名： distribution.Deleted
     */
    public Boolean getDeleted() {
        return deleted;
    }

    /**
     * 设置参数<br><br>
     *
     *   逻辑删除<br>
     *<br>
     * 字段名： distribution.Deleted
     */
    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }

    /**
     * 获取参数<br><br>
     *
     *   创建用户    <br>
     *<br>
     * 字段名： distribution.CreateUser
     */
    public String getCreateUser() {
        return createUser;
    }

    /**
     * 设置参数<br><br>
     *
     *   创建用户<br>
     *<br>
     * 字段名： distribution.CreateUser
     */
    public void setCreateUser(String createUser) {
        this.createUser = createUser == null ? null : createUser.trim();
    }

    /**
     * 获取参数<br><br>
     *
     *   创建时间    <br>
     *<br>
     * 字段名： distribution.CreateTime
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * 设置参数<br><br>
     *
     *   创建时间<br>
     *<br>
     * 字段名： distribution.CreateTime
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * 获取参数<br><br>
     *
     *   修改用户    <br>
     *<br>
     * 字段名： distribution.UpdateUser
     */
    public String getUpdateUser() {
        return updateUser;
    }

    /**
     * 设置参数<br><br>
     *
     *   修改用户<br>
     *<br>
     * 字段名： distribution.UpdateUser
     */
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser == null ? null : updateUser.trim();
    }

    /**
     * 获取参数<br><br>
     *
     *   修改时间    <br>
     *<br>
     * 字段名： distribution.UpdateTime
     */
    public Date getUpdateTime() {
        return updateTime;
    }

    /**
     * 设置参数<br><br>
     *
     *   修改时间<br>
     *<br>
     * 字段名： distribution.UpdateTime
     */
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public enum Deleted {
        NOT_DELETED(new Boolean("false"), "未删除"),
        IS_DELETED(new Boolean("true"), "已删除");

        private final Boolean value;

        private final String name;

        Deleted(Boolean value, String name) {
            this.value = value;
            this.name = name;
        }

        public Boolean getValue() {
            return this.value;
        }

        public Boolean value() {
            return this.value;
        }

        public String getName() {
            return this.name;
        }
    }

    public enum Column {
        distributionId("DistributionId", "distributionId", "INTEGER", false),
        departmentId("DepartmentId", "departmentId", "INTEGER", false),
        type("Type", "type", "INTEGER", true),
        distributionRatio("DistributionRatio", "distributionRatio", "DECIMAL", false),
        distributionAmt("DistributionAmt", "distributionAmt", "DECIMAL", false),
        deleted("Deleted", "deleted", "BIT", false),
        createUser("CreateUser", "createUser", "VARCHAR", true),
        createTime("CreateTime", "createTime", "TIMESTAMP", false),
        updateUser("UpdateUser", "updateUser", "VARCHAR", false),
        updateTime("UpdateTime", "updateTime", "TIMESTAMP", false);

        private static final String BEGINNING_DELIMITER = "`";

        private static final String ENDING_DELIMITER = "`";

        private final String column;

        private final boolean isColumnNameDelimited;

        private final String javaProperty;

        private final String jdbcType;

        public String value() {
            return this.column;
        }

        public String getValue() {
            return this.column;
        }

        public String getJavaProperty() {
            return this.javaProperty;
        }

        public String getJdbcType() {
            return this.jdbcType;
        }

        Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
            this.column = column;
            this.javaProperty = javaProperty;
            this.jdbcType = jdbcType;
            this.isColumnNameDelimited = isColumnNameDelimited;
        }

        public String desc() {
            return this.getEscapedColumnName() + " DESC";
        }

        public String asc() {
            return this.getEscapedColumnName() + " ASC";
        }

        public static Column[] excludes(Column ... excludes) {
            ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
            if (excludes != null && excludes.length > 0) {
                columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
            }
            return columns.toArray(new Column[]{});
        }

        public String getEscapedColumnName() {
            if (this.isColumnNameDelimited) {
                return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
            } else {
                return this.column;
            }
        }

        public String getAliasedEscapedColumnName() {
            StringBuilder sb = new StringBuilder();
            sb.append("distribution.");
            sb.append(this.getEscapedColumnName());
            sb.append(" as ");
            if (this.isColumnNameDelimited) {
                sb.append(BEGINNING_DELIMITER);
            }
            sb.append("distribution_");
            sb.append(this.column);
            if (this.isColumnNameDelimited) {
                sb.append(BEGINNING_DELIMITER);
            }
            return sb.toString();
        }
    }
}